<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>在线测试</title>
<script type="text/javascript">
function sel1(value) {
	
	var loader=new net.AjaxRequest("${pageContext.request.contextPath }/exam/ajaxcourse.action?noticeid="+value+"&nocache="+new Date().getTime(), del_sel1, onerror, "GET" );
}
function del_sel1() {
	 var result=this.req.responseText.split(";");
	 var cids=result[0].split(",");
	 var cnames=result[1].split(",");
	 document.getElementById("sel2").length=1;
	  for (var i  = 0; i  < tids.length; i ++) {
			document.getElementById("sel2").options[i+1]=new Option(cnames[i],cids[i]);
	    } 
}

function onerror(){
	alert("操作有误");
}

function test() {
	
	var sel1=document.getElementById("sel1").value;
	var sel2=document.getElementById("sel2").value;
	if(sel1==""){
		alert("请选择培训期号");
		return false;
	}
	if(sel2==""){
		alert("请选择课程");
		return false;
	}
	var loader=new net.AjaxRequest("${pageContext.request.contextPath }/exam/ajaxtest.action?noticeid="+sel1+"&courid="+sel2+"&nocache="+new Date().getTime(), del_test, onerror, "GET" );

}

function del_test() {
	 var result=this.req.responseText.split(";");
	 var flag=result[0];
	 var uu=result[1];
	 if(flag=="0"){
		 alert(uu);
	 }
	 else if(flag=="1"){ 
	 }
	 else{
		 alert(uu); 
	 }
	 
}

</script>

</head>
<body>
 
<select  id="sel1" onchange="sel1(this.value);">
<option value="" selected="selected" >培训期号</option>
<c:forEach items="noticeid" var="id">
<option  value="${id }">${id }"</option>

</c:forEach>
</select>
<select  id="sel2" onchange="sel2();">
<option   value="" selected="selected">课程</option>
</select>
<input type="button"  onclick="test()" value="确定">

<iframe  ></iframe>
</body>
</html>